package redis

import (
	"fmt"
	"github.com/go-redis/redis"
	"product/appconfig"
)

var Client *redis.Client

func ExampleNewClient() {
	var Cons = appconfig.Con.Redis
	Client = redis.NewClient(&redis.Options{
		Addr:     Cons.Addr,
		Password: Cons.Password, // no password set
		DB:       Cons.DB,       // use default DB
	})

	pong, err := Client.Ping().Result()
	fmt.Println(pong, err)
	// Output: PONG <nil>
	if err != nil {
		fmt.Println("redis连接失败")
		return
	}
	fmt.Println(Cons)
	fmt.Println("redis连接成功")
}
